//
//  SecondModel.m
//  WY
//
//  Created by dllo on 15/11/23.
//  Copyright © 2015年 李光耀. All rights reserved.
//

#import "SecondModel.h"

@implementation SecondModel


- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dictionary];
        
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if ([key isEqualToString:@"ads"]) {
        NSArray *array=value;
        NSMutableArray *mutableArray=[[NSMutableArray alloc]init];
        for (NSDictionary *dic in array) {
            adsArray *ads=[[adsArray alloc]initWithDictionary:dic];
            [mutableArray addObject:ads];
            NSLog(@"%@", ads.title);
        }
        self.adsSource=[NSArray arrayWithArray:mutableArray];
    }
    if ([key isEqualToString:@"imgextra"]) {
        NSArray *array=value;
        NSMutableArray *mutablearray=[[NSMutableArray alloc]init];
        for (NSDictionary *dic in array) {
            adsArray *ads=[[adsArray alloc]initWithDictionary:dic];
            [mutablearray addObject:ads];
        }
        self.imgextraSource=[NSArray arrayWithArray:mutablearray];
    }
    
    
}

@end
